var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/businessComponent/imp/utils.tsx
var utils_exports = {};
__export(utils_exports, {
  columnsToTableColumns: () => columnsToTableColumns,
  findFilterIndexes: () => findFilterIndexes,
  loopTreeChildren: () => loopTreeChildren,
  queryItemsToFormItems: () => queryItemsToFormItems
});
module.exports = __toCommonJS(utils_exports);
function columnsToTableColumns(columns) {
  return columns.filter((r) => r.isDisplay).map((r) => ({
    sortable: false,
    dataIndex: r.fieldName,
    title: r.fieldAlias || r.fieldName,
    flex: 1,
    format: r.format,
    width: r.fieldWidth || 100
  }));
}
function queryItemsToFormItems(queryItems) {
  return queryItems.map((r) => {
    const item = { label: r.fieldAlias || r.fieldName, name: r.fieldName };
    r.helpId && (item.helpId = r.helpId);
    r.displayType && (item.xtype = r.displayType);
    r.enumValue && (item.data = r.enumValue.split(";").map((item2) => {
      const vl = item2.split("|");
      return { value: vl[0], label: vl[1] };
    }));
    return item;
  });
}
function findFilterIndexes(arr, func) {
  const result = [];
  arr.forEach((it, index) => {
    if (func(it)) {
      result.push(index);
    }
  });
  return result;
}
function loopTreeChildren(treeList) {
  let result = [];
  treeList.forEach((it) => {
    var _a;
    result.push(it.key);
    if ((_a = it.children) == null ? void 0 : _a.length) {
      result = result.concat(loopTreeChildren(it.children));
    }
  });
  return result;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  columnsToTableColumns,
  findFilterIndexes,
  loopTreeChildren,
  queryItemsToFormItems
});
